package com.zh.auth.enums;

import lombok.Getter;

/**
 * RSA密钥储存模式
 */
@Getter
public enum RsaModeEnum {
    STRICT("strict"),
    TEMPORARY("temporary"),
    PERMANENT("permanent");

    private final String mode;

    RsaModeEnum(String mode) {
        this.mode = mode;
    }

    public static RsaModeEnum fromString(String mode) {
        if (mode == null) {
            throw new IllegalArgumentException("Mode cannot be null");
        }
        for (RsaModeEnum rsaMode : values()) {
            if (rsaMode.mode.equalsIgnoreCase(mode)) {
                return rsaMode;
            }
        }
        throw new IllegalArgumentException("Invalid mode: " + mode);
    }
}
